<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simAddParticleObject</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1><a href="../apiOverview.htm">Regular API</a> function</h1>
<h3 class=subsectionBar><a name="simAddParticleObject" id="simAddParticleObject"></a>simAddParticleObject / sim.addParticleObject </h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Adds a particle object that will be simulated and displayed in the scene. Particle objects are containers that hold several items (particles) of a given type. This can be used for several different applications (e.g. simulation of air/water jets) See also <a href="simAddParticleObjectItem.htm">sim.addParticleObjectItem</a> and <a href="simRemoveParticleObject.htm">sim.removeParticleObject</a><br></td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simAddParticleObject(simInt objectType,simFloat size,simFloat density,const simVoid* parameters,simFloat lifeTime,simInt maxItemCount,const simFloat* ambient_diffuse,const simFloat* setToNULL,const simFloat* specular,const simFloat* emission)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>objectType</strong>: a <a href="../apiConstants.htm#particleObjects">particle object type combined with attributes</a></div>
<div><strong>size</strong>: diameter of the particles (spheres)</div>
<div><strong>density</strong>: density of the particles</div>
<div><strong>parameters</strong>: points to an array of values, allowing to specify additional parameters. Can be nullptr. The first value (an integer) indicates how many parameters will be set. All following values come in pair (an integer indicating what parameter, and a float indicating the parameter value. Following indicates the parameters:
</div>
<div class=tab>0: Bullet friction coefficient (default: 0.0)</div>
<div class=tab>1: Bullet restitution coefficient (default: 0.0)</div>
<div class=tab>2: ODE friction coefficient (default: 0.0)</div>
<div class=tab>3: ODE soft ERP value (default: 0.2)</div>
<div class=tab>4: ODE soft CFM values (default: 0.0)</div>
<div class=tab>5: Bullet, ODE, Newton and Vortex linear drag parameter (default: 0.0). Adds a force opposite to the particle velocity (f=v*parameter)</div>
<div class=tab>6: Bullet, ODE, Newton and Vortex quadratic drag parameter (default: 0.0). Adds a force opposite to the particle velocity (f=v*v*parameter)</div>
<div class=tab>7: Bullet, ODE, Newton and Vortex linear drag parameter in air (z>0) if sim_particle_water was specified (default: 0.0). Adds a force opposite to the particle velocity (f=v*parameter)</div>
<div class=tab>8: Bullet, ODE, Newton and Vortex quadratic drag parameter in air (z>0) if sim_particle_water was specified (default: 0.0). Adds a force opposite to the particle velocity (f=v*v*parameter)</div>
<div class=tab>9: Vortex friction (default: 0.0)</div>
<div class=tab>10: Vortex restitution (default: 0.0)</div>
<div class=tab>11: Vortex restitution threshold (default: 0.001)</div>
<div class=tab>12: Vortex compliance (default: 0.0)</div>
<div class=tab>13: Vortex damping (default: 0.0)</div>
<div class=tab>14: Vortex adhesive force (default: 0.0)</div>
<div class=tab>15: Newton static friction (default: 0.0)</div>
<div class=tab>16: Newton kinetic friction (default: 0.0)</div>
<div class=tab>17: Newton restitution (default: 0.0)</div>
<div class=tab>If a parameter is not set, then its default value is used. As an example, following array: [3,0,0.5,2,0.5,9,0.5] will set Bullet's,  ODE's and Vortex's friction coefficients to 0.5<br>
</div>
<div><strong>lifeTime</strong>: simulation time after which the particles are destroyed. Set to 0.0 for an unlimited lifetime.</div>
<div><strong>maxItemCount</strong>: the maximum number of particles that this object can hold</div>
<div><strong>ambient_diffuse</strong>: default ambient/diffuse color (pointer to 3 rgb values). Can be nullptr</div>
<div><strong>setToNULL</strong>: not used, set to nullptr</div>
<div><strong>specular</strong>: default specular color (pointer to 3 rgb values). Can be nullptr</div>
<div><strong>emission</strong>: default emissive color (pointer to 3 rgb values). Can be nullptr</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>handle of the particle object if successful, -1 otherwise</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>number particleObjectHandle=sim.addParticleObject(number objectType,number size,number density,table parameters,number lifeTime,number maxItemCount,table_3 ambient_diffuse=nil,nil,table_3 specular=nil,table_3 emission=nil)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div>Similar to the C-function counterpart</div>
<div></div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div>Similar to the C-function counterpart</div>
<div></div></td> 
</tr> 
</table> 

<br>
<p><a href="../apiFunctions.htm">All regular API functions on one page</a></p>
<br>
<br>
</td>
</tr>
</table>
</div>
</body>
</html>
